package com.woniuxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.entity.ArticleComment;
import com.woniuxy.mapper.ArticleCommentMapper;
import com.woniuxy.service.IArticleCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



/**
 * @Author pml
 * @Date 2025/7/18 16:30
 * @Description TODO
 * 评论服务实现类
 */
@Service
public class ArticleCommentServiceImpl extends ServiceImpl<ArticleCommentMapper, ArticleComment> implements IArticleCommentService {

    @Autowired
    private ArticleCommentMapper articleCommentMapper;

    @Override
    public long countTotalComments() {
        // 查询未删除的评论总数
        LambdaQueryWrapper<ArticleComment> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ArticleComment::getIsDeleted, 0);
        return articleCommentMapper.selectCount(queryWrapper);
    }
}